package com.cyzy.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cyzy.dto.Result;
import com.cyzy.pojo.CampusOrder;
import com.cyzy.pojo.Trade;
import com.cyzy.service.CampusOrderService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Random;

@RestController
@RequestMapping("/campusOrder")
public class CampusOrderController {

    @Autowired
    private CampusOrderService campusOrderService;

    @GetMapping("/selectAll")
    public Result selectAllUser(@RequestParam(required = false) String orderStatus,
                                @RequestParam(required = false) String userId,
                                @RequestParam(required = false) int pageNum,
                                @RequestParam(required = false) int pageSize){

        Page<CampusOrder> campusOrders  = campusOrderService.selectAll(orderStatus, userId, pageNum, pageSize);
        return Result.ok().data("campusOrders",campusOrders);
   }
}

